package org.ucas.kgraph.utils.exception;

import org.springframework.http.HttpStatus;
import org.ucas.kgraph.utils.constants.ErrCode;

/**
 * 权限禁止类异常
 * @author suemi
 */
public class ForbiddenException extends RestException {

  public static final ForbiddenException DEFAULT =
          new ForbiddenException(ErrCode.FORBIDDEN);

  public static final ForbiddenException DISABLED_ACCOUNT =
          new ForbiddenException(ErrCode.DISABLED_ACCOUNT);

  public static final ForbiddenException WRONG_TOKEN =
          new ForbiddenException(ErrCode.WRONG_TOKEN);
  
  public static final ForbiddenException WRONG_CODE =
          new ForbiddenException(ErrCode.WRONG_CODE);
  
  public static final ForbiddenException WRONG_COM =
          new ForbiddenException(ErrCode.WRONG_COM);
  
  public static final ForbiddenException INVALID_ROOTID =
          new ForbiddenException(ErrCode.INVALID_ROOTID);

  public static final ForbiddenException DIFFERENT_ROOTID =
          new ForbiddenException(ErrCode.DIFFERENT_ROOTID);

  public static final ForbiddenException FORBIDDEN =
          new ForbiddenException(ErrCode.FORBIDDEN);

  
  private ForbiddenException(ErrCode errCode) {
    super(errCode);
  }


  public static ForbiddenException of(String msg) {
    return new ForbiddenException(new ErrCode(
            HttpStatus.FORBIDDEN, msg));
  }
}
